define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'project.projects/index',
        add_url: 'project.projects/add',
        edit_url: 'project.projects/edit',
        delete_url: 'project.projects/delete',
        export_url: 'project.projects/export',
        modify_url: 'project.projects/modify',
    };

    return {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id',search: false, title: '编号'},
                    {field: 'cate_id', search: 'select', selectList: cateSelects, title: '项目分类'},
                    {field: 'title',width: 150,  title: '标题'},
                    {field: 'user.nickname', title: '用户'},
                    {field: 'contact',title: '联系人'},
                    {field: 'mobile', title: '联系电话'},
                    {field: 'village_id', search: 'select',selectList: villageSelects, title: '村名'},
                    {field: 'likes',search:  false, title: '点赞量'},
                    {field: 'approve_status', title: '审批状态',search: 'select',selectList: approveSelects, laySearch: true},
                    {field: 'sort',search: false, title: '排序', edit: 'text'},
                    {field: 'is_recommend', search: 'select', selectList: {0: '不推荐', 1: '推荐'},templet: ea.table.switch, title: '是否推荐'},
                    {field: 'project_status', search: 'select',title: '项目状态',selectList: projectStatus, laySearch: true},
                    {field: 'create_time', search: false, title: '创建时间'},
                    {width: 250, title: '操作', templet: ea.table.tool},

                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
});